<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
		<title>文档回收站</title>
		<link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
		<link rel="stylesheet" href="/static/web/css/bootstrap.min.css">
		<link rel="stylesheet" href="/static/web/css/admin.css">
	</head>
	<body>
		<div class="container-fluid">
			<ol class="breadcrumb">
				<li class="breadcrumb-item"><a href="index_body.php">后台面板</a></li>
				<li class="breadcrumb-item active">文档回收站</li>
			</ol>
			<div class="card shadow-sm">
				<div class="card-header">文档回收站</div>
				<div class="card-body">
					<form name="form2">
						<div class="table-responsive">
							<table class="table table-borderless table-hover">
								<thead>
									<tr>
										<td scope="col">id</td>
										<td scope="col">选择</td>
										<td scope="col">文档标题</td>
										<td scope="col">栏目</td>
										<td scope="col">更新时间</td>
										<td scope="col">点击</td>
										<td scope="col">操作</td>
									</tr>
								</thead>
								<tbody>
									{dede:datalist}
									<tr>
										<td>{dede:field.id/}</td>
										<td><input type="checkbox" name="arcID" value="{dede:field.id/}"></td>
										<td align="left"><a href="archives_do.php?aid={dede:field.id/}&dopost=editArchives">{dede:field.title/}</a></td>
										<td>{dede:field.typename/}</td>
										<td>{dede:field.senddate function='GetDateMk(@me)'/}</td>
										<td>{dede:field.click/}</td>
										<td>
											<a href="javascript:moveArc({dede:field.id/});" class="btn btn-light btn-sm"><i class="fa fa-repeat" title="还原"></i></a>
											<a href="javascript:delArc({dede:field.id/});" class="btn btn-danger btn-sm"><i class="fa fa-trash" title="删除"></i></a>
										</td>
									</tr>
									{/dede:datalist}
									<tr>
										<td colspan="7">
											<a href="javascript:selAll();" class="btn btn-success btn-sm">全选</a>
											<a href="javascript:noSelAll();" class="btn btn-success btn-sm">取消</a>
											<a href="javascript:moveArc(0);" class="btn btn-success btn-sm">还原</a>
											<a href="javascript:delArc(0);" class="btn btn-danger btn-sm">删除</a>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</form>
					{dede:pagelist listsize='6'/}
				</div>
			</div>
		</div>
		<script>
			function getCheckboxItem() {
				var allSel = '';
				if (document.form2.arcID.value) return document.form2.arcID.value;
				for (i = 0; i < document.form2.arcID.length; i++) {
					if (document.form2.arcID[i].checked) {
						if (allSel == "")
							allSel = document.form2.arcID[i].value;
						else
							allSel = allSel + "`" + document.form2.arcID[i].value;
					}
				}
				return allSel;
			}
			function getOneItem() {
				var allSel = '';
				if (document.form2.arcID.value) return document.form2.arcID.value;
				for (i = 0; i < document.form2.arcID.length; i++) {
					if (document.form2.arcID[i].checked) {
						allSel = document.form2.arcID[i].value;
						break;
					}
				}
				return allSel;
			}
			function selAll() {
				if (typeof document.form2.arcID === "object") {
					document.form2.arcID.checked = true;
				}
				for (i = 0; i < document.form2.arcID.length; i++) {
					if (!document.form2.arcID[i].checked) {
						document.form2.arcID[i].checked = true;
					}
				}
			}
			function noSelAll() {
				if (typeof document.form2.arcID === "object") {
					document.form2.arcID.checked = false;
				}
				for (i = 0; i < document.form2.arcID.length; i++) {
					if (document.form2.arcID[i].checked) {
						document.form2.arcID[i].checked = false;
					}
				}
			}
			function moveArc(aid) {
				var qstr = getCheckboxItem();
				if (aid == 0) aid = getOneItem();
				location = "archives_do.php?aid=" + aid + "&dopost=return&qstr=" + qstr;
			}
			function delArc(aid) {
				var qstr = getCheckboxItem();
				if (aid == 0) aid = getOneItem();
				location = "archives_do.php?qstr=" + qstr + "&aid=" + aid + "&dopost=del&recycle=1";
			}
		</script>
	</body>
</html>